<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	
	$action = chkstr(trim($_REQUEST['action']));
	$user_phone = chkstr(trim($_REQUEST['user_phone']));
	$user_phonecode = chkstr(trim($_REQUEST['user_phonecode']));
	
	if($action != "edit"){
		echo erro("参数错误！");
	}
	
	// 手机号验证
	if(!isMobile($user_phone)){
		echo erro("手机号格式错误！");
	}

	// 验证码验证
	if(strlen($user_phonecode)<1){
		echo erro("请正确输入验证码！");
	}
	if($user_phone != $_SESSION['PhoneName']){
		echo erro("请正确输入验证码！");
	}
	if($user_phonecode != $_SESSION['PhoneCode']){
		echo erro("请正确输入验证码！");
	}
	
	$is_reguser = getNewsNums("kboy_user","user_phone='$user_phone'");
	if($is_reguser<1){
		echo erro("该用户不存在！");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改密码_<?= $web_titles ?></title>
<meta name="Keywords" content="修改密码,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/style.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <div class="find-pass-box">
        <div class="find-step-wrap">
            <div class="find-step-box">
                <div class="f-step-l">
                    <ul>
                        <li><span class="set-size">01</span>选择找回方式</li>
                        <li><span class="cut"></span></li>
                        <li><span class="set-size">02</span>进行安全验证</li>
                        <li><span class="cut"></span></li>
                        <li><span class="set-size">03</span>设置新密码</li>
                    </ul>
                </div>
                <div class="f-step-r"><a href="index.php" class="back"><i class="icon-back"></i>返回网站首页</a></div>
            </div>
        </div>
        <div class="find-step-bd">
            <div class="find-step-in">
                <div class="step-title">第三步：设置新密码</div>
				<form name="editpwd" id="editpwd" method="post" action="getpwd_phone_editaddsave.php?action=save">
				<input type="hidden" id="user_phone" name="user_phone" value="<?=$user_phone?>" />
				<input type="hidden" id="user_phonecode" name="user_phonecode" value="<?=$user_phonecode?>" />
                <div class="step-test">
                    <ul>
                        <li>
                            <span class="m-l">新密码：</span>
                            <div class="m-r">
                                <input type="password" class="m-find-input" name="user_password" id="user_password" value=""/>
                            </div>
                        </li>
                        <li class="mt20">
                            <span class="m-l">确认新密码：</span>
                            <div class="m-r">
                                <input type="password" class="m-find-input" name="user_repassword" id="user_repassword" value=""/>
                            </div>
                        </li>
                        <li class="mt30">
                            <span class="m-l"></span>
                            <div class="m-r">
                                <input type="submit" name="m-f-btn" class="m-f-btn" value="下一步" /><a class="m-f-btn cancel" href="login.php">取消</a>
                            </div>
                        </li>
                    </ul>
                </div>
				</form>
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
	<script language="javascript">
	$(document).ready(function(){
		// 表单提交
		$("#editpwd").submit(function(){
			var user_password = $("#user_password").val();
			var user_repassword = $("#user_repassword").val();

			// 密码验证
			if(user_password.replace(/\ /g,"").length<5){
				alert("密码不能少于5位字符！");
				$("#user_password").focus();
				return false;
			}
			if(user_repassword.replace(/\ /g,"").length<5){
				alert("两次密码输入不一致！");
				$("#user_repassword").focus();
				return false;
			}
			if(user_password != user_repassword){
				alert("两次密码输入不一致！");
				$("#user_password").focus();
				return false;
			}
		});
	});
	</script>
</body>
</html>